import xlrd


class LoginData:

    def getSuccessData(self):

        return self.read_data(sheet_name='success')

    def getUserNameErrorData(self):
        return self.read_data(sheet_name='NameError')

    def getPasswordErrorData(self):
        return self.read_data(sheet_name='PasswordError')

    def read_data(self,sheet_name):
        wordBook = xlrd.open_workbook(filename='../TestData/test_login_data.xls')
        sheet = wordBook.sheet_by_name(sheet_name)
        arr = []
        for i in range(1, sheet.nrows):
            e = sheet.row_values(i)
            if type(e[1]) is float:
                e[1] = str(int(e[1]))
            arr.append(e)
        return arr

